import type { RouteRecordRaw } from 'vue-router'

// 预加载所有用户视图组件
import UserLayout from '@/views/userViews/layouts/index.vue'
import UserOverview from '@/views/userViews/overview/index.vue'
import HealthEvaluation from '@/views/userViews/healthEvaluation/index.vue'
import UserProfile from '@/views/userViews/profile/index.vue'
import UserSchedule from '@/views/userViews/schedule/index.vue'
import DataMonitor from '@/views/userViews/healthArchive/dataMonitor/index.vue'
import ArchiveManagement from '@/views/userViews/healthArchive/archiveManagement/index.vue'
import HealthPlan from '@/views/userViews/healthManagement/healthPlan/index.vue'
import IntegratedPlan from '@/views/userViews/healthManagement/healthPlan/components/integratedPlan.vue'
import LifestyleManagement from '@/views/userViews/healthManagement/healthPlan/components/lifestyleManagement.vue'
import MentalHealthSupport from '@/views/userViews/healthManagement/healthPlan/components/mentalHealthSupport.vue'
import PreventionPromotion from '@/views/userViews/healthManagement/preventionPromotion/index.vue'
import FamilyHealth from '@/views/userViews/healthManagement/familyHealth/index.vue'
import OnlineConsultation from '@/views/userViews/medicalService/onlineConsultation/index.vue'
import DoctorDetail from '@/views/userViews/medicalService/onlineConsultation/doctorDetail/index.vue'
import EmergencyService from '@/views/userViews/medicalService/emergencyService/index.vue'
import UserAppointment from '@/views/userViews/medicalService/appointment/index.vue'
import AppointmentDoctorDetail from '@/views/userViews/medicalService/appointment/doctorDetail/index.vue'

const routes: RouteRecordRaw[] = [
  {
    path: '/user',
    component: UserLayout,
    redirect: '/user/overview',
    meta: {
      role: 'user',
      requiresAuth: true
    },
    children: [
      //概览
      {
        path: 'overview',
        component: UserOverview,
        meta: { requiresAuth: true }
      },
      //健康评估
      {
        path: 'health-evaluation',
        component: HealthEvaluation,
        meta: { requiresAuth: true },
      },
      //个人中心
      {
        path: 'profile',
        component: UserProfile,
        meta: { requiresAuth: true }
      },
      //日程
      {
        path: 'schedule',
        component: UserSchedule,
        meta: { requiresAuth: true }
      },
      //健康档案
      //数据监测
      {
        path: 'data-monitor',
        component: DataMonitor,
        meta: { requiresAuth: true }
      },
      //档案管理
      {
        path: 'archive-management',
        component: ArchiveManagement,
        meta: { requiresAuth: true }
      },
      //健康管理
      {
        path: 'health-plan',
        component: HealthPlan,
        meta: { requiresAuth: true },
        children: [
          {
            path: 'integrated-plan',
            component: IntegratedPlan,
            meta: { requiresAuth: true }
          },
          {
            path: 'lifestyle-management',
            component: LifestyleManagement,
            meta: { requiresAuth: true }
          },
          {
            path: 'mental-health-support',
            component: MentalHealthSupport,
            meta: { requiresAuth: true }
          }
        ]
      },
      {
        path: 'prevention-promotion',
        component: PreventionPromotion,
        meta: { requiresAuth: true }
      },
      {
        path: 'family-health',
        component: FamilyHealth,
        meta: { requiresAuth: true }
      },
      //诊疗服务
      {
        path: 'online-consultation',
        component: OnlineConsultation,
        meta: { requiresAuth: true },
      },
      {
        path: 'online-consultation/doctorDetail',
        component: DoctorDetail,
        meta: { requiresAuth: true },
      },
      {
        path: 'emergency-service',
        component: EmergencyService,
        meta: { requiresAuth: true }
      },
      {
        path: 'user-appointment',
        component: UserAppointment,
        meta: { requiresAuth: true }
      },
      {
        path: 'appointment/doctorDetail/:doctorId',
        component: AppointmentDoctorDetail,
        meta: { requiresAuth: true }
      },

    ]
  }
]

export default routes
